package com.asset.controller;

import com.asset.common.BaseResponse;
import com.asset.common.ResultUtils;
import com.asset.model.vo.CompanyTreeNodeVO;
import com.asset.service.CompanyService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/company")
public class CompanyController {

    @Resource
    private CompanyService companyService;

    /**
     * 获取公司树形结构
     */
    @GetMapping("/tree")
    public BaseResponse<List<CompanyTreeNodeVO>> getCompanyTree() {
        List<CompanyTreeNodeVO> tree = companyService.getCompanyTree();
        return ResultUtils.success(tree);
    }
}